From c37786af360ac1e2b205bff6d84bf47a64253d54 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 27 Apr 2023 01:27:50 +0200 Subject: [PATCH] win32: Actually increase the counter We were sending random junk to ChoosePixelFormat(). Also assert that we don't overflow the array. That might be usefu to know if we carelessly add attributes later. --- gdk/win32/gdkglcontext-win32-wgl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gdk/win32/gdkglcontext-win32-wgl.c b/gdk/win32/gdkglcontext-win32-wgl.c index cc3c3097a9..c6cdbfb533 100644 --- a/gdk/win32/gdkglcontext-win32-wgl.c +++ b/gdk/win32/gdkglcontext-win32-wgl.c @@ -153,7 +153,7 @@ get_wgl_pfd (HDC hdc, HGLRC hglrc_current = wglGetCurrentContext (); /* Update PIXEL_ATTRIBUTES above if any groups are added here! */ - pixelAttribs[i] = WGL_DRAW_TO_WINDOW_ARB; + pixelAttribs[i++] = WGL_DRAW_TO_WINDOW_ARB; pixelAttribs[i++] = GL_TRUE; pixelAttribs[i++] = WGL_SUPPORT_OPENGL_ARB; @@ -183,6 +183,7 @@ get_wgl_pfd (HDC hdc, } pixelAttribs[i++] = 0; /* end of pixelAttribs */ + g_assert (i <= PIXEL_ATTRIBUTES); best_pf = gdk_init_dummy_wgl_context (display_win32); if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc, @@ -196,8 +197,8 @@ get_wgl_pfd (HDC hdc, pixelAttribs, NULL, 1, - &best_pf, - &num_formats); + &best_pf, + &num_formats); /* Go back to the HDC that we were using, since we are done with the dummy HDC and GL Context */ wglMakeCurrent (hdc_current, hglrc_current); -- 2.30.2